local zaifa = fk.CreateSkill{
  name = "lz__zaifa",
}

Fk:loadTranslationTable{
  ["lz__zaifa"] = "再伐",
  [":lz__zaifa"] = "你不因“再伐”使用即时牌后，可展示手牌，若不包含之花色则将一张牌当之使用。额外，若你没有手牌，改为对自己使用【增兵减灶】，然后你本回合不能发动“再伐”。",
  ["#lz__zaifa-use"] = "再伐：你可将一张牌当%arg使用",

  ["$lz__zaifa1"] = "三秦父老箪食迎，岂可空负官军名！",
  ["$lz__zaifa2"] = "灞水秋风卷铁甲，不破长安不书凯！",
}

-- 再伐技能：使用即时牌后展示手牌
zaifa:addEffect(fk.CardUseFinished, {
  anim_type = "offensive",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(zaifa.name) and data.card.skillName ~= zaifa.name
    and data.card.type ~= Card.TypeEquip and data.card.sub_type ~= Card.SubtypeDelayedTrick
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if player:isKongcheng() then
      room:useVirtualCard("reinforcement", nil, player, player, zaifa.name, true)
      room:addTableMark(player, MarkEnum.InvalidSkills .. "-turn", zaifa.name)
    else
      player:showCards(player:getCardIds("h"))
      if table.every(player:getCardIds("h"), function (id) return Fk:getCardById(id).suit ~= data.card.suit end)
      and not data.card.is_passive then
        room:askToUseVirtualCard(player, {
          name = data.card.name,
          skill_name = zaifa.name,
          prompt = "#lz__zaifa-use:::"..data.card:toLogString(),
          cancelable = false,
          card_filter = {
            n = 1,
          },
        })
      end
    end
  end,
})

return zaifa